﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/static/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <base href="<%=basePath%>">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta charset="utf-8"/>
    <title>订舱</title>
    <meta name="description" content=""/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
    <link rel="stylesheet" href="static/ace/css/bootstrap.css"/>
    <link rel="stylesheet" href="static/ace/css/font-awesome.css"/>
    <!-- text fonts -->
    <link rel="stylesheet" href="static/ace/css/ace-fonts.css"/>
    <!-- ace styles -->
    <link rel="stylesheet" href="static/ace/css/ace.css" class="ace-main-stylesheet" id="main-ace-style"/>
    <link rel="stylesheet" type="text/css" href="plugins/websocketInstantMsg/ext4/resources/css/ext-all.css">
    <script type="text/javascript" src="plugins/websocketInstantMsg/ext4/ext-all-debug.js"></script>

</head>

<body class="no-skin">
<!-- /section:basics/navbar.layout -->
<div class="main-container" id="main-container">
    <div id="output"></div>
</div>
</body>

<script type="text/javascript">


    var f1=Ext.create('Ext.form.field.Text',{
        fieldLabel: '提单类型',
        name: 'f1',
        columnWidth: 1/3,
        readOnly :true,
        value:"提单类型"

    });
    var f2=Ext.create('Ext.form.field.Text',{
        fieldLabel: '销售人员',
        name: 'f2',
        columnWidth: 1/3,
        value:'房屋地址不能为空'
    });
    var f3=Ext.create('Ext.form.field.Text',{
        fieldLabel: '所属部门',
        columnWidth: 1/3,
        name: 'f3',
        value:'所属部门'
    });

    var f4=Ext.create('Ext.form.field.Text',{
        fieldLabel: '所属部门',
        columnWidth: 1/3,
        name: 'f4',
        value:'所属部门'
    });

    var f5=Ext.create('Ext.form.field.Text',{
        fieldLabel: '所属部门',
        columnWidth: .3,
        name: 'f5',
        value:'所属部门'
    });


    var mainForm1 = Ext.create('Ext.form.Panel', {
        name:'mainForm1',
        title: '托单信息',
        height:document.documentElement.clientHeight * 0.46,
//        width:document.documentElement.clientWidth * 0.97,
        style : 'margin:5px 10px 5px 10px;',
        autoScroll:true,
        layout : 'form',
        bodyStyle: {
            padding: '5px',
            border:1
        },
        fieldDefaults: { labelAlign: 'right'},
        items: [
            {layout : 'column', baseCls : 'my-panel-no-border', padding: '155px', items: [f1,f2,f3] },
            {layout : 'column', baseCls : 'my-panel-no-border',padding: '155px',  items: [f4,f5] }
        ]
    });

//*********************************************************************************************

    var ff1=Ext.create('Ext.form.field.Text',{
        fieldLabel: '托单编号',
        name: 'billCode',
        columnWidth: 1/3,
        readOnly :true,
        value:'${billCode}'
    });
    var ff2=Ext.create('Ext.form.field.Text',{
        fieldLabel: '主提单号',
        name: 'ladingBillCode',
        columnWidth: 1/3,
        bodyStyle : "padding-top: 15px; padding-left:10px;"
    });
    var ff3=Ext.create('Ext.form.field.Text',{
        fieldLabel: '订舱操作备注',
        name: 'bookingOperationNotes',
        columnWidth: 1/3,
    });
    var ff4=Ext.create('Ext.form.field.Text',{
        fieldLabel: '海船靠区',
        name: 'loadingGoingShips',
        columnWidth: 1/3,
    });
    var ff5=Ext.create('Ext.form.field.Text',{
        fieldLabel: '订舱海船航线',
        name: 'bookingShippingRoutes',
        columnWidth: 1/3
    });
    var ff6=Ext.create('Ext.form.field.Date',{
        fieldLabel: '订舱海船期',
        name: 'bookingSeagoingVessels',
        columnWidth: 1/3,
        format: 'Y-m-d'
    });
    var ff7=Ext.create('Ext.form.field.Text',{
        fieldLabel: '运输条款',
        name: 'transportClause',
        columnWidth: 1/3
    });
    var ff8=Ext.create('Ext.form.field.Text',{
        fieldLabel: 'HS CODE',
        name: 'hsCode',
        columnWidth: 1/3
    });
    var ff9=Ext.create('Ext.form.field.Text',{
        fieldLabel: '约号',
        name: 'aboutNo',
        columnWidth: 1/3
    });
    var ff10=Ext.create('Ext.form.field.Text',{
        fieldLabel: '订舱卸货港',
        name: 'bookingDischargingPort',
        columnWidth: 1/3

    });
    var ff11=Ext.create('Ext.form.field.Text',{
        fieldLabel: '订舱交货地',
        name: 'bookingPlaceDelivery',
        columnWidth: 1/3
    });
    var ff12=Ext.create('Ext.form.field.Text',{
        fieldLabel: '海船周次',
        name: 'sailingTimes',
        columnWidth: 1/3
    });

    var save=Ext.create('Ext.Button',{
        text: '保存',
        name: 'save',
        minWidth:70,
        icon:'../plugins/websocketInstantMsg/ext4/shared/icons/fam/add.png',
        style: {
            marginBottom: '10px',//距底部高度
            marginLeft:'10px',//距左边宽度
            marginRight:'10px'//距右边宽度
        },
        listeners: {
            click: formSubmit
        }
    });
    var cancel=Ext.create('Ext.Button',{
        text: '关闭',
        name: 'cancel',
        minWidth:70,
        style: {
            marginBottom: '10px',//距底部高度
            marginLeft:'10px',//距左边宽度
            marginRight:'10px'//距右边宽度
        },
        icon:'../plugins/websocketInstantMsg/ext4/shared/icons/fam/add.png',
        handler:function(){
            parent.win.close();
        }
    });

    var mainForm2 = Ext.create('Ext.form.Panel', {
        name:'mainForm2',
        title: '修改操作',
        height:document.documentElement.clientHeight * 0.5,
        style : 'margin:5px 10px 0px 10px;',
        autoScroll:true,
        layout : 'form',
        bodyStyle: {
            padding: '5px',
            border:1
        },
        fieldDefaults: { labelAlign: 'right'},
        items: [
            {layout : 'column', baseCls : 'my-panel-no-border',padding: '10px', items: [ff1,ff2,ff3] },
            {layout : 'column', baseCls : 'my-panel-no-border',padding: '10px',  items: [ff4,ff5,ff6] },
            {layout : 'column', baseCls : 'my-panel-no-border',padding: '10px',  items: [ff7,ff8,ff9] },
            {layout : 'column', baseCls : 'my-panel-no-border',padding: '10px',  items: [ff10,ff11,ff12]},
            {layout : 'column', baseCls : 'my-panel-no-border',   padding: '5px',  items: [
                {layout : 'column',baseCls : 'my-panel-no-border', columnWidth: 2/5,   padding: '10px'},
                {layout : 'column',baseCls : 'my-panel-no-border',columnWidth: 1/5,  padding: '10px',  items: [save , cancel]},
                {layout : 'column',baseCls : 'my-panel-no-border', columnWidth: 2/5,  padding: '10px'}

            ]}
        ]
    });


    Ext.onReady(function(){
        mainForm1.render(document.body);
        mainForm2.render(document.body);
        load();
    })

    function formSubmit(){
        var form = this.up('form').getForm();
        if (form.isValid()) {
            form.submit({
                url:"../bookingCargo/bookingCargo",
                waitMsg : '数据在处理中,请稍后......',
                waitTitle : '提示',
                method : 'POST',
                success: function(form, action) {
                    Ext.Msg.alert("提示", "订舱信息保存成功！",function(){
                        parent.win.close();
                    });
                },
                failure: function(form, action) {
                    console.log(action);
                    Ext.Msg.alert("提示","保存订舱信息失败！");
                }
            });
        }
    }

    /*加载订舱数据*/
    function load(){
        if('' == '${billCode}' ){
            return ;
        }
        Ext.Ajax.request({
            url: '../bookingCargo/queryBookingCargo',
            params: { billCode: '${billCode}' },
            method: 'GET',
            success: function (response) {
                var responseJson = Ext.JSON.decode(response.responseText);
                mainForm2.getForm().setValues(responseJson.result);
            },
            failure: function (response) {
                Ext.MessageBox.alert('失败', '获取订舱信息失败！');
            }});
    }




</script>

</html>